import request from "@/utils/request";

export function  getSimple() {
    return request({
        url: '/sys/user/simple',
        method:'get'
    })
}

// 获取员工列表
export function getEmployeeList(params) {
    return request({
        url: '/sys/user',
        method: 'get',
        params
    })
}

// 删除员工
export function  delEmployee(id) {
    return request({
        url: `/sys/user/${id}`,
        method:'delete'
    })
}

// 新增员工
export function addEmployee(data) {
    return request({
        url: "/sys/user",
        method: 'post',
        data
    })
}

// 批量导入员工
export function  importEmployee(data) {
    return request({
        url: '/sys/user/batch',
        method: 'post',
        data
    })
}

// 保存员工基本信息
export function saveUserDetailById(data) {
    return request({
        url: `/sys/user/${data.id}`,
        method: "put",
        data
    })
}


// 获取员工个人信息
export function getPersonalDetail(id) {
    return request({
        url: `/employees/${id}/personalInfo`,
    })
}

// 保存员工个人信息
export function setPersonalDetail(data) {
    return request({
        url: `/employees/${data.userId}/personalInfo`,
        method: "put",
        data
    })
}

// 获取员工个人岗位信息
export function getJobs(id) {
    return request({
        url:`/employees/${id}/jobs`,
    })
}

// 保存员工个人岗位信息
export function setJobs(data) {
    return request({
        url: `/employees/${data.userId}/jobs`,
        method: "put",
        data
    })
}

// 给员工分配角色
export function assignRoles(data) {
    return request({
        url: `/sys/user/assignRoles`,
        method: 'put',
        data
    })
}